import request from "@/utils/request";
/** 订单查询参数 */
export interface OrderQuery {
  current?: number;
  pageSize?: number;
  clientId?: number;
  openId?: string;
  payType?: string;
  status?: string;
  refundRequest?: number;
}
/** 订单表单 */
export interface OrderForm {
  appId?: string;
  body?: string;
  caseType?: string | null;
  clientId?: string | null;
  clientIp?: string | null;
  clientUserName?: string | null;
  consultationServiceInfo?: any;
  createdAt?: string;
  expiredTime?: string | null;
  id?: string;
  lawyerId?: string | null;
  lawyerName?: string | null;
  mchId?: string;
  notifyUrl?: string;
  openId?: string;
  payAmount?: number;
  payMoney?: number;
  payType?: string | null;
  payWay?: string | null;
  refundReason?: string | null;
  refundRequest?: number;
  serviceId?: string | null;
  serviceName?: string | null;
  status?: string;
  statusDesc?: string;
  subject?: string | null;
  successTime?: string | null;
  transactionId?: string | null;
  updateAt?: string;
  wxMiniProgramId?: string | null;
}
/** 订单对象 */
export interface OrderVO {
  current?: number;
  pages?: number;
  records?: any;
  createdAt?: string;
  size?: number;
  total: number;
}
class orderAPI {
  /** 获取分页订单列表 */
  static getOrder(params: OrderQuery) {
    return request<any, OrderVO>({
      url: "/api/pay/order/getPage",
      method: "post",
      data: params,
    });
  }
  /** 根据id查询订单 */
  static getOrderById(id: number) {
    return request<any, OrderVO>({
      url: `/api/pay/order/${id}`,
      method: "get",
      // data: params,
    });
  }
  /** 查询订单结果 */
  static getOrderResult(id: number) {
    return request<any, OrderVO>({
      url: `/api/pay/order/result/${id}`,
      method: "get",
      // data: params,
    });
  }
  /** 退款 */
  static getOrderRefund(id: number) {
    return request<any, OrderVO>({
      url: `/api/pay/order/refund?id=${id}`,
      method: "post",
      // data: params,
    });
  }
  /** 订单导出 */
  static downOrder(params: OrderForm) {
    return request({
      url: "/api/pay/order/export",
      method: "post",
      data: params,
    });
  }
}

export default orderAPI;
